require "administrate/base_dashboard"

class OrderDashboard < Administrate::BaseDashboard
  # ATTRIBUTE_TYPES
  # a hash that describes the type of each of the model's fields.
  #
  # Each different type represents an Administrate::Field object,
  # which determines how the attribute is displayed
  # on pages throughout the dashboard.
  ATTRIBUTE_TYPES = {
    user: Field::BelongsTo,
    account: Field::BelongsTo,
    customer: Field::BelongsTo,
    introducer: Field::HasOne,
    strategy_result: Field::HasOne,
    _region: Field::BelongsTo,
    store: Field::BelongsTo,
    id: Field::Number,
    uuid: Field::String,
    width: Field::Number,
    height: Field::Number,
    expected_square: Field::Number.with_options(decimals: 2),
    booking_date: Field::DateTime,
    rate: Field::Number.with_options(decimals: 2),
    total: Field::Number.with_options(decimals: 2),
    remark: Field::String,
    state: Field::String,
    courier_number: Field::String,
    install_date: Field::DateTime,
    cgj_company_id: Field::Number,
    cgj_customer_id: Field::Number,
    cgj_facilitator_id: Field::Number,
    cgj_customer_service_id: Field::Number,
    material: Field::String,
    material_id: Field::Number,
    workflow_state: Field::String,
    public_order: Field::Boolean,
    square: Field::Number.with_options(decimals: 2),
    mount_order: Field::Boolean,
    serial_number: Field::String,
    is_company: Field::Boolean,
    measure_amount: Field::Number.with_options(decimals: 2),
    install_amount: Field::Number.with_options(decimals: 2),
    manager_confirm: Field::Boolean,
    region: Field::String,
    terminal_count: Field::Number.with_options(decimals: 2),
    amount_total_count: Field::Number.with_options(decimals: 2),
    basic_order_tax: Field::Number,
    measure_amount_after_comment: Field::Number,
    installed_amount_after_comment: Field::Number,
    measure_comment: Field::Number,
    measure_raty: Field::Number.with_options(decimals: 2),
    installed_raty: Field::Number.with_options(decimals: 2),
    service_measure_amount: Field::Number.with_options(decimals: 2),
    service_installed_amount: Field::Number.with_options(decimals: 2),
    basic_tax: Field::Number.with_options(decimals: 2),
    deduct_installed_cost: Field::Number.with_options(decimals: 2),
    deduct_measure_cost: Field::Number.with_options(decimals: 2),
    sale_commission: Field::Number,
    intro_commission: Field::Number,
    created_at: Field::DateTime,
    updated_at: Field::DateTime,
    introducer_name: Field::String,
    introducer_tel: Field::String,
    introducer_id: Field::Number,
    province: Field::String,
    city: Field::String,
    area: Field::String,
    region_id: Field::String,
    estimated_total: Field::Number.with_options(decimals: 2),
    rebate: Field::Number.with_options(decimals: 2),
    measure_master: Field::String,
  }.freeze

  # COLLECTION_ATTRIBUTES
  # an array of attributes that will be displayed on the model's index page.
  #
  # By default, it's limited to four items to reduce clutter on index pages.
  # Feel free to add, remove, or rearrange items.
  COLLECTION_ATTRIBUTES = [
    :id,
    :serial_number,
    :customer,
    :user,
    :booking_date,
  ].freeze

  # SHOW_PAGE_ATTRIBUTES
  # an array of attributes that will be displayed on the model's show page.
  SHOW_PAGE_ATTRIBUTES = [
    :user,
    :account,
    :customer,
    # :introducer,
    :strategy_result,
    :_region,
    :store,
    :id,
    :uuid,
    :width,
    :height,
    :expected_square,
    :booking_date,
    :rate,
    :total,
    :remark,
    :state,
    :courier_number,
    :install_date,
    :cgj_company_id,
    :cgj_customer_id,
    :cgj_facilitator_id,
    :cgj_customer_service_id,
    :material,
    :material_id,
    :workflow_state,
    :public_order,
    :square,
    :mount_order,
    :serial_number,
    :is_company,
    :measure_amount,
    :install_amount,
    :manager_confirm,
    # :region,
    :terminal_count,
    :amount_total_count,
    :basic_order_tax,
    :measure_amount_after_comment,
    :installed_amount_after_comment,
    :measure_comment,
    :measure_raty,
    :installed_raty,
    :service_measure_amount,
    :service_installed_amount,
    :basic_tax,
    :deduct_installed_cost,
    :deduct_measure_cost,
    :sale_commission,
    :intro_commission,
    :created_at,
    :updated_at,
    :introducer_name,
    :introducer_tel,
    :introducer_id,
    :province,
    :city,
    :area,
    # :region_id,
    :estimated_total,
    :rebate,
    :measure_master,
  ].freeze

  # FORM_ATTRIBUTES
  # an array of attributes that will be displayed
  # on the model's form (`new` and `edit`) pages.
  FORM_ATTRIBUTES = [
    :user,
    # :account,
    # :customer,
    # :introducer,
    # :strategy_result,
    :_region,
    :store,
    # :uuid,
    # :width,
    # :height,
    :expected_square,
    :booking_date,
    # :rate,
    # :total,
    # :remark,
    # :state,
    # :courier_number,
    # :install_date,
    # :cgj_company_id,
    # :cgj_customer_id,
    # :cgj_facilitator_id,
    # :cgj_customer_service_id,
    # :material,
    # :material_id,
    # :workflow_state,
    # :public_order,
    # :square,
    # :mount_order,
    # :serial_number,
    # :is_company,
    # :measure_amount,
    # :install_amount,
    # :manager_confirm,
    # :region,
    # :terminal_count,
    # :amount_total_count,
    # :basic_order_tax,
    # :measure_amount_after_comment,
    # :installed_amount_after_comment,
    # :measure_comment,
    # :measure_raty,
    # :installed_raty,
    # :service_measure_amount,
    # :service_installed_amount,
    # :basic_tax,
    # :deduct_installed_cost,
    # :deduct_measure_cost,
    # :sale_commission,
    # :intro_commission,
    # :introducer_name,
    # :introducer_tel,
    # :introducer_id,
    # :province,
    # :city,
    # :area,
    # :region_id,
    :estimated_total,
    # :rebate,
    # :measure_master,
  ].freeze

  # Overwrite this method to customize how orders are displayed
  # across all pages of the admin dashboard.
  #
  # def display_resource(order)
  #   "Order ##{order.id}"
  # end
end
